<template>
  <div class="article-item">
    <van-cell :to="'/article/' + article.art_id" :title="article.title" size="large">
    <!-- <van-cell :to="'/article?id=' + article.art_id" :title="article.title" size="large"> -->
    <!-- <van-cell :to="{name: 'article', params: {
      articleId: article.art_id
    }}" :title="article.title" size="large"> -->
      <!-- 自定义标题区域下方的结构 -->
      <div slot="label" class="custom-label">
        <div v-if="article.cover.type === 3" class="cover-images">
          <van-image v-for="(item, index) in article.cover.images" :key="index" fit="cover" :src="item"/>
        </div>
        <span>{{ article.aut_name }}</span>
        <span class="common">{{ article.comm_count }}评论</span>
        <span>{{ article.pubdate | formatDate }}</span>
      </div>

      <!-- 自定义右侧内容区域: 默认插槽 -->
      <van-image v-if="article.cover.type === 1" class="right-image" fit="contain" :src="article.cover.images[0]"/>
    </van-cell>
  </div>
</template>

<script>
export default {
  data () {
    return {

    }
  },

  props: {
    // 父组件传递的文章列表项数据
    article: {
      type: Object,
      required: true
    }
  },

  created () {

  },

  methods: {

  }
}
</script>

<style scoped lang='less'>
.article-item {
  .van-cell__title,
  .van-cell__value {
    flex: unset;
  }
  // 自定义label
  .custom-label {
    font-size: 23px;
    color: #999;
    span {
      // margin: 24px 0px;
      display: inline-block;
    }
    .common {
      margin-left: 10px;
      margin-right: 10px;
    }

    // 三张图片封面
    .cover-images {
      display: flex;
      margin: 30px 0;
      .van-image {
        width: 232px;
        height: 146px;
      }

      .van-image:nth-child(2) {
        margin: 0 3px;
      }
    }
  }

  // 自定义右侧内容
  .right-image {
    width: 232px;
    height: 146px;
  }
}
</style>
